#[derive(Debug)]
pub struct Command {
    crate_size: usize,
    from_stack_id: usize,
    to_stack_id: usize,
}

impl Command {
    pub fn crate_size(&self) -> usize {
        self.crate_size
    }

    pub fn from_stack_id(&self) -> usize {
        self.from_stack_id
    }

    pub fn to_stack_id(&self) -> usize {
        self.to_stack_id
    }
}

impl From<&str> for Command {
    fn from(value: &str) -> Self {
        // move 6 from 5 to 7
        let tokens = value.split_whitespace().collect::<Vec<&str>>();
        Self {
            crate_size: tokens[1].parse().unwrap(),
            from_stack_id: tokens[3].parse::<usize>().unwrap() - 1,
            to_stack_id: tokens[5].parse::<usize>().unwrap() - 1,
        }
    }
}
